#ifndef __OSK_CLASSES
#define __OSK_CLASSES

#include "osk_cmd.h"

/*---------------------------------------------------------------------------
  OSKKey
    Simple, local customizable keys

  OSKKeyFx
    Simple, non-character keys (arrows, Fx, ...)

  OSKKeySym
    Shift modifiers

  OSKKeyCmd
    Command buttons:
      - OSK int commands
      - text macro
      - switch keyboards
      - run programm
  ---------------------------------------------------------------------------*/
enum OSKTypes_t {
  otKey,
  otKeyFx,
  otKeySym,
  otKeyCmd
};

enum OSKCmd_t {
  ocMinimize,
  ocConfigure,
  osSysMenu,
  ocClose,
  ocSwitchKeyboard,
  ocSelectKeyboard,
  ocConstMacro,           //Send text from FileName
  ocVarMacro,             //Send text from focused edit
  ocExecute,
  ocShortCut,
  ocLayoutChange,
};

#define BASE TCustomToolbarButton97
LOCALCLASSBASE( OSKCustomKey, public BASE )
  protected:
    void __fastcall idOnClick( TObject *Sender );

  public:
    __fastcall OSKCustomKey( TComponent *Owner );

    void __fastcall ApplyKeySate( LPBYTE state, HKL layout );
    void __fastcall ResetKeyState( void );

//public
    OSKTypes_t Type;
    HWND       OSKWindow;

    int GetOpt( CONSTSTR nm, int def ) { return OSKWindow ? SendMessage( OSKWindow, MSG_OSK_GETOPT, (WPARAM)nm, (LPARAM)def ) : def; }

//published
    DEF_PROP_VP( AnsiString,    KeyLabel,  ; )
DEF_PROP_VV_DEF( int,           KeyCode,   0 )
DEF_PROP_VV_DEF( OSKCmd_t,      Command,   -1 )
    DEF_PROP_VV( AnsiString,    FileOrCommand )
    DEF_PROP_VV( TEdit*,        BufferEdit )
    DEF_PROP_VV( TShortCut,     ShortCut )
};
#undef BASE

//---------------------------------------------------------------------------
LOCALCLASSBASE( OSKKey, public OSKCustomKey )
  public:
    __fastcall OSKKey( TComponent *Owner ) : OSKCustomKey( Owner ) { Type = otKey; KeyLabel = "A"; }

  __published:
  //BASE
    __property //Std
               Align, Anchors, Color, CoverColor, Constraints, Font, Margin, NoBorder,
               Flat, Opaque, ShowBorderWhenInactive, ShowHint, Spacing,
               //Repeat
               Repeating, RepeatDelay, RepeatInterval;
  //OSKCustomKey
    __property KeyLabel, KeyCode;

};

LOCALCLASSBASE( OSKKeyFx, public OSKCustomKey )
  public:
    __fastcall OSKKeyFx( TComponent *Owner );

  __published:
  //BASE
    __property //Std
               Align, Anchors, Color, CoverColor, Constraints, Font, Margin, NoBorder,
               Flat, Opaque, ShowBorderWhenInactive, ShowHint, Spacing, WordWrap,
               //Repeat
               Repeating, RepeatDelay, RepeatInterval,
               //Img
               DisplayMode, Glyph, GlyphMask, Layout, NumGlyphs;
  //OSKCustomKey
    __property KeyLabel, KeyCode;

};

LOCALCLASSBASE( OSKKeySym, public OSKCustomKey )
  public:
    __fastcall OSKKeySym( TComponent *Owner );

  __published:
  //BASE
    __property //Std
               Align, Anchors, Color, CoverColor, Constraints, Font, Margin, NoBorder,
               Flat, Opaque, ShowBorderWhenInactive, ShowHint, Spacing, WordWrap,
               //Img
               DisplayMode, Glyph, GlyphMask, Layout, NumGlyphs;
  //OSKCustomKey
    __property KeyLabel, KeyCode;
};

LOCALCLASSBASE( OSKKeyCmd, public OSKCustomKey )
  public:
    __fastcall OSKKeyCmd( TComponent *Owner );

  __published:
  //BASE
    __property //Std
               Align, Anchors, Color, CoverColor, Constraints, Font, Margin, NoBorder,
               Flat, Opaque, ShowBorderWhenInactive, ShowHint, Spacing, WordWrap,
               //Repeat
               Repeating, RepeatDelay, RepeatInterval,
               //Img
               DisplayMode, Glyph, GlyphMask, Layout, NumGlyphs;
  //OSKCustomKey
    __property KeyLabel, Command, FileOrCommand, BufferEdit, ShortCut;
};
//---------------------------------------------------------------------------
struct ControlInfo {
  TControlClass Class;
  CONSTSTR      Description;

  ControlInfo( TControlClass c, CONSTSTR d ) : Class(c), Description(d) {}
  ControlInfo( const ControlInfo& c ) : Class(c.Class), Description(c.Description) {}
};

//---------------------------------------------------------------------------
//[dsClasses.cpp]
ControlInfo   GetCustomClass( int idx );
int           RegisterCustomClasses( void );

#endif